using System;
using System.Collections.Generic;
using System.Text;
using Pixysoft.Tools;
using Pixysoft.Weblications.Sango.Formular;
using Pixysoft.Framework.Verifications;
using Pixysoft.Framework.Noebe;

namespace Pixysoft.Weblications.Sango.Environment
{
    public class CityBuildingHelper
    {
        private static List<Entities.Cti_Building> orms = new List<Pixysoft.Weblications.Sango.Entities.Cti_Building>();

        public static void initialize()
        {
            orms = SettingHelper.GetNoebe().EntityNoebeCommand.Select<Entities.Cti_Building>();
            LoggerHelper.Info("initialize Cti_Building.count:{0}", orms.Count);
        }

        public static List<Entities.Cti_Building> searchAll()
        {
            return orms;
        }

        public static Entities.Cti_Building searchBuilding(long typecode)
        {
            foreach (Entities.Cti_Building orm in orms)
            {
                if (typecode == orm.Buildingtypecode)
                {
                    return orm;
                }
            }

            throw Exceptions.VerificationFailedException(typecode);
        }
    }
}